package com.lifeCicle.beans;

import com.lifeCicle.entities.Notebooks;

import javax.faces.component.UIComponent;
import javax.faces.component.html.HtmlInputText;
import javax.faces.component.html.HtmlOutputText;
import javax.faces.context.FacesContext;
import javax.faces.event.ValueChangeEvent;

import oracle.adf.view.rich.component.rich.input.RichInputText;


public class LifeCicleBean {

    private Notebooks notebook;
    private String email;
    private RichInputText emailTxt;
    private String prueba;

    public LifeCicleBean() {
    }

    public void inputText_validator(FacesContext facesContext,
                                    UIComponent uIComponent, Object object) {
    }
    // Init ----------------------------------------------------------------------------------------

       private HtmlInputText inputComponent;
       private String inputValue;
       private HtmlOutputText outputComponent;
       private String outputValue;
       // Actions ------------------------------------------------------------------------------------

       public void action() {
           outputValue = inputValue;
           log("succes");
       }

       // Getters ------------------------------------------------------------------------------------

       public HtmlInputText getInputComponent() {
           log(inputComponent);
           return inputComponent;
       }

       public String getInputValue() {
           log(inputValue);
           return inputValue;
       }

       public HtmlOutputText getOutputComponent() {
           log(outputComponent);
           return outputComponent;
       }

       public String getOutputValue() {
           log(outputValue);
           return outputValue;
       }

       // Setters ------------------------------------------------------------------------------------

       public void setInputComponent(HtmlInputText inputComponent) {
           log(inputComponent);
           this.inputComponent = inputComponent;
       }

       public void setInputValue(String inputValue) {
           log(inputValue);
           this.inputValue = inputValue;
       }
       
      public void setNotebook(Notebooks notebook) {
            log(notebook);
           this.notebook = notebook;
        }

     public Notebooks getNotebook() {
        return  this.notebook;
      }
    
       public void setOutputComponent(HtmlOutputText outputComponent) {
           log(outputComponent);
           this.outputComponent = outputComponent;
       }

       // Listeners ----------------------------------------------------------------------------------

       public void inputChanged(ValueChangeEvent event) {
           log(event.getOldValue() + " to " + event.getNewValue());
       }

       // Helpers ------------------------------------------------------------------------------------

       private void log(Object object) {
           String methodName = Thread.currentThread().getStackTrace()[2].getMethodName();
           System.out.println("LifeCicleBean " + methodName + ": " + object);
       }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getEmail() {
        return email;
    }

    public void setEmailTxt(RichInputText emailTxt) {
        this.emailTxt = emailTxt;
    }

    public RichInputText getEmailTxt() {
        return emailTxt;
    }

    public void setPrueba(String prueba) {
        this.prueba = prueba;
    }

    public String getPrueba() {
        return prueba;
    }
}
